<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="sealte.hvpms.pojo.Admin" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>仓鼠网上投票系统HVPMS</title>
<link type="text/css" rel="stylesheet" href="css/messages_add.jsp.css" />
<script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
function validateToSubmit(){
	var title = $('#title').val();
	var content = $('#content').val();
	var mform = $('#messageForm');
	var reg = /^\s+|\s+$/g;
	title = title.replace(reg,"");
	content = content.replace(reg,"");
	if(title!=""){
		if(content!=""){
			mform.submit();
		}else{
			alert("消息内容不能为空！");
		}
	}else{
		alert("消息主题不能为空！");
	}
}
</script>
</head>
<body>
<%
	Admin admin = (Admin)session.getAttribute("admin");
	if(admin!=null){
%>
<div id="num2">
	<h2><img src="images/messages_view.png">&nbsp;系统消息管理--新增</h2>
</div>

<div id="num1">
<form action="AdminAddMessage" method="POST" id="messageForm">
<table>
	<tr>
		<th>消息主题：</th>
		<td><input type="text" name="messageTitle" size="71" id="title"/></td>
	</tr>
	<tr>
		<th>消息内容：</th>
		<td valign="top"><textarea cols="60" rows="15" name="messageContent" id="content"></textarea></td>
	</tr>
	<tr>
		<td></td>
		<td align="left">
			<input type="button" value="提交" onclick="validateToSubmit()"/>
			<input type="reset" value="重置"/>
		</td>
	</tr>
</table>
<input type="hidden" value="<%=admin.getId()%>" name="messageFrom"/>
</form>
</div>
<span id="getBackMessage">
		<%
			String message_add = (String)request.getAttribute("message_add");
			if(message_add!=null&&!message_add.equals("")){
				out.println("[<font color=red>"+message_add+"</font>]");
			}
		%>
</span>
<%	
	}else{
		out.println("谢绝跨路径访问！");
	}
%>
</body>
</html>